home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / operation-graduates.swf / scripts / frame_41 / DoAction_12.as < prev    next >
Text File  |  2011-10-17  |  2KB  |  77 lines

  1. function spawnBeehive(xSpot)
  2. {
  3.    var _loc1_ = enemyContainer.attachMovie("beehive","enemy" + eConCount++,eConCount);
  4.    _loc1_._x = xSpot;
  5.    _loc1_._y = -20;
  6.    _loc1_.myBuzz = new Sound(_loc1_);
  7.    _loc1_.myBuzz.attachSound("sound.beehive.loop");
  8.    _loc1_.vel = new Vector();
  9.    _loc1_.des = new Vector();
  10.    _loc1_.energy = 70;
  11.    _loc1_.gotoAndStop(1);
  12.    _loc1_.disturbed = false;
  13.    _loc1_.move = beehiveMover;
  14.    _loc1_.Q1logic = baddyQ1;
  15.    _loc1_.Q2logic = baddyQ2;
  16.    _loc1_.Q3logic = baddyQ3;
  17.    _loc1_.Q4logic = baddyQ4;
  18.    _loc1_.hit = beehiveHit;
  19.    _loc1_.isHit = false;
  20.    _loc1_.collide = beehiveCollide;
  21. }
  22. function beehiveHit()
  23. {
  24.    var _loc1_ = this;
  25.    if(!_loc1_.disturbed)
  26.    {
  27.       _loc1_.myBuzz.start(0,999);
  28.       _loc1_.disturbed = true;
  29.    }
  30.    else
  31.    {
  32.       _loc1_.isHit = true;
  33.       _loc1_.setRGB(16777215);
  34.       _loc1_.energy -= 5;
  35.       if(_loc1_.energy <= 0)
  36.       {
  37.          _loc1_.myBuzz.stop();
  38.          playSound("sound.beehive.explode");
  39.          explode(_loc1_);
  40.          addScore(250);
  41.          baddyKillCount++;
  42.       }
  43.    }
  44. }
  45. function beehiveMover()
  46. {
  47.    var _loc1_ = this;
  48.    if(_loc1_.isHit)
  49.    {
  50.       _loc1_.resetColor();
  51.       _loc1_.isHit = false;
  52.    }
  53.    if(_loc1_.disturbed)
  54.    {
  55.       _loc1_.des.reset(theHull._x - _loc1_._x,theHull._y - _loc1_._y);
  56.       _loc1_.des.setLength(0.5);
  57.       _loc1_.vel.plus(_loc1_.des);
  58.       _loc1_.vel.setLength(3);
  59.       _loc1_._x += _loc1_.vel.x;
  60.       _loc1_._y += _loc1_.vel.y;
  61.       _loc1_._rotation = Math.atan2(_loc1_.vel.y,_loc1_.vel.x) * 57.29577951308232 - 90;
  62.    }
  63.    else
  64.    {
  65.       _loc1_._y += 3;
  66.       if(_loc1_._y > 420)
  67.       {
  68.          _loc1_.removeMovieClip();
  69.       }
  70.    }
  71. }
  72. function beehiveCollide()
  73. {
  74.    this.myBuzz.stop();
  75.    explode(this);
  76. }
  77.